<!DOCTYPE html>
<!-- saved from url=(0097)http://www.17sucai.com//preview/331792/2017-11-22/%E5%A4%9A%E4%BA%BA%E6%8A%BD%E5%A5%96/index.html -->
<html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	
	<title>抽奖</title>
	<link rel="stylesheet" type="text/css" href="./抽奖_files/style.css">
</head>
<body>
	<div class="bg">
		<img src="./抽奖_files/bg.jpg">
	</div>
	<div class="box">
		<div class="jz">
			<span class="name">姓名</span><br>
			<span class="phone">电话</span><br>
			<div style="margin:0 auto;float:none;" class="start" id="btntxt" onclick="start()">大奖</div>
			<!--<div class="start xn2" id="btnluck" onclick="luck()">幸运奖</div>-->
		</div>
		<div class="zjmd">
			<p class="p1">中奖者名单</p>
			<div class="list" id="content">
				<!-- <div class="xyjmd"><h1>幸运奖</h1></div> -->
				<div class="zjmd_bt_xy"></div>
				<div class="dajmd"><h1></h1></div>
				<div class="zjmd_bt_dj"></div>
			</div>
			<div class="clear"></div>
			
		</div>
		<!-- 文件保存格式 value="" -->
		<input type="text" name="filename" id="filename" value="中奖名单.txt" style="display:none;">
		<!-- .csv后缀 -->
		<button class="start svbtn" id="saveBtn">保存名单</button>
	</div>
	<div class="confirmbox">
		<div class="zj_top">
			<img src="./抽奖_files/zj_top.png" alt="">
		</div>
		<div class="lucknum">
				
		</div>
		<div class="conbox">
			
		</div>
		<div class="clear"></div>
		<div class="btnbox">
			<div  style="margin:0 auto;float:none;" class="start new_s daj" id="btnqr" onclick="">确认</div>
			<!--<div class="start new_s 22stop" id="btnqx" onclick="" style="background:#FC6666;">取消</div>-->
		</div>
		<div class="zj_bottom">
			<img src="./抽奖_files/zj_bottom.png" alt="">
		</div>
	</div>
	
	<script type="text/javascript" src="./抽奖_files/jquery-1.8.0.js.js"></script>
	<script type="text/javascript">
        var xinm = new Array();
        var phone = new Array();

        function initData(noders) {
            var rm = noders.data;
            $.each(rm,function (index, nrm) {
                if(nrm){
                    var rmArray = $.trim(nrm).split(/[ ]+/g);
                    console.log(rmArray)
                    xinm.push(rmArray[0]);
                    var photoNum = rmArray[1];
                    if(photoNum){
                        photoNum = photoNum.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2')
                    }
                    phone.push(photoNum || '1**********');
				}
            });
        }
	</script>
	<script type="text/javascript" src="/upload/getRm?callback=initData"></script>
	<script type="text/javascript" src="./抽奖_files/cj.js"></script>
	<script type="text/javascript" src="./抽奖_files/blob.js"></script>
	<script type="text/javascript" src="./抽奖_files/filesaver.js"></script>
	<script>
      (function(){
        document.getElementById("saveBtn").onclick = function(event){
          event.preventDefault();
          var BB = self.Blob;
          saveAs(
              new BB(
                ["\ufeff" + document.getElementById("content").innerHTML] //\ufeff防止utf8 bom防止中文乱码
              , {type: "text/plain;charset=utf8"}
            )
            , document.getElementById("filename").value
          );
        };
      })();

      	var i = 1;
	    $('.xn').live('click', function() {
			
			$('.lucknum').text('第'+i+'1 -- '+(i+1)+'0名');
			i++;
		});
		$('.xn2').one('click',function(){
			$('.lucknum').text('第1 -- 10名');
		})


		$(window).keyup(function (evt) {
		    console.log(evt.keyCode)
			if(evt.keyCode == 13 || evt.keyCode == 32){
			    var confimEl = $('.confirmbox');
			    if(!confimEl.is(':hidden')){
                    confimEl.find('#btnqr').click();
				}else{
                    $('#btntxt').click();
				}
			}else if(evt.keyCode == 27 || evt.keyCode == 8){
                var confimEl = $('.confirmbox');
                if(!confimEl.is(':hidden')){
//                    confimEl.find('#btnqx').click();
                }else{
                    $('#btntxt').click();
                }
            }
        })
	</script>

</body></html>